# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.shortcuts import render, get_object_or_404

# Create your views here.
from .models import BlogArticles
def blog_title(request):
    blogs = BlogArticles.objects.all() #得到所有BlogArticles的对象实例
    return render(request, "blog/titles.html",{"blogs":blogs})

def blog_article(request,article_id):
   # article = BlogArticles.objects.get(id=article_id)
    article = get_object_or_404(BlogArticles,id=article_id)
    pub = article.publish
    return render(request,"blog/content.html",{"article":article,"publish":pub})
